#!/usr/bin/env node


//const user = 'wangding'
//     pwd = '123456';

//const user_pwd = `${user}:${pwd}`;

//    console.log(user_pwd);

//const buf = Buffer.from(user_pwd);

//    console.log(buf.toString('base64'));

const log = console.log;
const usr = process.argv[2];
const pwd = process.argv[3];
log('终端获取');
if(process.argv.length !== 4) {
  console.error('命令行格式：cmd username password');
  process.exit(1);//exit-->1
}
log('user name: %s\npassword: %s',usr,pwd);

const buf = Buffer.from(usr + ':' + pwd);

log('Base64:', buf.toString('Base64'));

